public class Solution {
    
    public boolean isStrobogrammatic(String num) {
        Map<Character,Character> map = new HashMap<Character,Character>();
        map.put('0','0');
        map.put('1','1');
        map.put('6','9');
        map.put('8','8');
        map.put('9','6');
        
        int left = 0, right = num.length() - 1;
        while(left <= right) {
            if(!map.containsKey(num.charAt(right)) || num.charAt(left) != map.get(num.charAt(right)))
                return false;
            left++;
            right--;
        }
        
        return true;
    }
    
}